package org.halk.kafka_springboot_demo.controller;

import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author halk
 * @Date 2023/5/19 14:43
 */
@RestController
public class KafkaSendTestController {

    @Resource
    private KafkaTemplate<String, String> kafkaTemplate;

    @GetMapping("/send/{str}")
    public void send(@PathVariable String str) {
        this.kafkaTemplate.send("halk", str);
    }
}
